package com.neusoft.service.impl;

import com.neusoft.dao.UmsAdminDao;
import com.neusoft.model.UmsAdmin;
import com.neusoft.service.UmsAdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

/**
 * @Author: duan
 * @Date: Create in 10:33 2020/10/28
 */
@Service
public class UmsAdminServiceImpl implements UmsAdminService {
    @Autowired
    private UmsAdminDao umsAdminDao;

    @Override
    public boolean insert(UmsAdmin bean) {
        System.out.println("insert开始");
        return umsAdminDao.insert(bean);
    }

    @Override
    public boolean update(UmsAdmin bean) {
        return umsAdminDao.update(bean);
    }

    @Override
    public boolean delete(Long id) {
        return umsAdminDao.delete(id);
    }

    @Override
    public UmsAdmin queryById(Long id) {
        return umsAdminDao.queryById(id);
    }

    @Override
    public List<UmsAdmin> queryList() {
        return umsAdminDao.queryList();
    }

    @Override
    public List<Map<String, Object>> queryListMap() {
        return umsAdminDao.queryListMap();
    }

    @Override
    public Integer getCount() {
        return umsAdminDao.getCount();
    }

    @Override
    @Transactional
    public void zhuanZhang() {
        umsAdminDao.add("haha", -100);
//        System.out.println(1 / 0);
        if (true) {
            throw new NullPointerException("中断了");
        }
        umsAdminDao.add("hehe", 100);
    }
}
